﻿@model StudentManagement.Models.Student

@{
    ViewBag.Title = "Edit - Student Information";
    Layout = "~/Views/Shared/_AdminNestedLayout.cshtml";
}
@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>Student</legend>

        @Html.HiddenFor(model => model.StudentId)

        <div class="editor-label">
            @Html.LabelFor(model => model.Name)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Name)
            @Html.ValidationMessageFor(model => model.Name)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.BranchId)
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.BranchId, (IEnumerable<SelectListItem>)ViewBag.Branches, "-- Select a Branch --", new { data_url = Url.Action("GetCourses") })
            @Html.ValidationMessageFor(model => model.BranchId)
        </div>



        <div class="editor-label">
            @Html.LabelFor(model => model.CourseId)
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.CourseId,(IEnumerable<SelectListItem>)ViewBag.Courses,"-- Select a Course --")
            @Html.ValidationMessageFor(model => model.CourseId)
        </div>


        <div class="editor-label">
            @Html.LabelFor(model => model.Gender)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Gender)
            @Html.ValidationMessageFor(model => model.Gender)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Address)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Address)
            @Html.ValidationMessageFor(model => model.Address)
        </div>

        <p>
            <input type="submit" value="Save" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
<script type="text/javascript">
    $(function () {
        InitChildDropdown('#BranchId', '#CourseId','--Select a Course--');
    });
</script>
}
